package lm.spring.feign.support;


import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * feign标记
 * @author liangming 2021-12-01
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface FeignClient {

    /**
     * 服务名或请求的服务地址
     * @return
     */
    String serviceName();

    /**
     * 调用的地址
     * @return
     */
    String path() default "/";

//    /**
//     * Whether to mark the feign proxy as a primary bean. Defaults to true.
//     */
//    boolean primary() default true;

    /**
     * 日志级别(默认使用全局配置feign.logLevel,全局配置默认为BASIC)
     * <ol>
     * <li>NONE:不记录任何日志</li>
     * <li>BASIC:仅记录请求方法，url,响应状态码以及执行时间</li>
     * <li>HEADERS:basic基础上，记录请求和响应的header</li>
     * <li>FULL:basic基础上，记录请求和响应的header,body,元数据</li>
     * <ol/>
     */
    String logLevel() default "";

    long readTimeout() default 60 * 1000;

    long connectTimeout() default 10 * 1000;

    /**
     * Encoder bean name for the specified Feign client interface, to encode parameters
     * in certain way. The encoder bean class must implement the class feign.codec.Encoder.
     */
    String encoder() default "feignEncoder";

    /**
     * Decoder bean name for the specified Feign client interface, to decode parameters
     * in certain way. The decoder bean class must implement the class feign.codec.Decoder.
     */
    String decoder() default "feignDecoder";

    /**
     * Error decoder bean name for the specified Feign client interface, to decode error
     * in certain way. The error decoder bean class must implement the class feign.codec.ErrorDecoder.
     */
    String errorDecoder() default "feignErrorDecoder";

    /**
     * http client bean name for the specified Feign client interface.
     * The client bean class must implement the class feign.Client.
     */
    String client() default "feignClient";
}
